package com.atguigu.gmall.order.service;

import com.atguigu.gmall.model.enums.OrderStatus;
import com.atguigu.gmall.model.order.OrderDetail;
import com.atguigu.gmall.model.order.OrderInfo;
import com.atguigu.gmall.order.to.OrderSplitTo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface OrderService extends IService<OrderInfo> {


    boolean checkToken(String userId, String tradeNo);

    List<String> checkSkuPriceAndStock(List<OrderDetail> orderDetailList);

    OrderInfo createOrder(OrderInfo orderInfo);

    /**
     * 关闭指定订单
     * @param id
     */
    void closeOrder(Long id);

    /**
     * 修改订单状态未---已支付
     * @param out_trade_no
     * @param name
     */
    void changeOrderStatusPayed(String out_trade_no, String name);

    OrderInfo getOrderInfoWithDetailsByOutTradeNo(String outTradeNo);

    List<OrderSplitTo> splitOrder(Long orderId, String wareSkuMap) throws JsonProcessingException;

    /**
     * 扣库存，修改订单状态
     * @param parseLong
     * @param waitingDelever
     */
    void changeOrderStatus(@Param("parseLong") long parseLong, @Param("waitingDelever") OrderStatus waitingDelever);

}
